Skip to content

Adding exception picker to license picker form#1118

Open
capfei wants to merge 6 commits intomasterfrom
with-and-ui-fixes
Open

Adding exception picker to license picker form#1118
capfei wants to merge 6 commits intomasterfrom
with-and-ui-fixes

Conversation

@capfei
Copy link
Copy Markdown
Member

@capfei capfei commented Mar 20, 2026

This allows UI users to submit curations with SPDX exceptions (WITH). More fixes to correct the table layout.

Test PRs submitted:

New WITH button:
image

New exception picker after clicking button:
image

Exception picker list:
image

Table layout fix:
image

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 20, 2026

Deploy Preview for blissful-goodall-fa23f6 failed.

Name Link
🔨 Latest commit cf3bf93
🔍 Latest deploy log https://app.netlify.com/projects/blissful-goodall-fa23f6/deploys/69c30dd1c4809100076604d8

@ashleywolf
Copy link
Copy Markdown

ashleywolf commented Mar 24, 2026

Thanks for adding SPDX exception support. A few things that came up to consider before merging:

Data corruption: space sentinel in exception initialization

Clicking "+ WITH" calls updateException(' ', path), setting the exception to a single space. Since ' ' is truthy, LicensePickerUtils.toString() serializes this as "MIT WITH " -- an invalid SPDX expression. The .trim() in the RuleBuilder display only affects the picker input, not the stored value. If a user clicks "+ WITH" and saves without selecting an exception, invalid data gets persisted.

Suggestion: use null or a separate boolean flag to track "picker is open" state instead of a whitespace sentinel. Or trim the exception in toString() and treat empty/whitespace as absent.

Shallow copy + nested mutation in updateException

updateException does { ...this.state.rules } (shallow copy) then mutates the nested object directly via currentRule.exception = value. For nested rules (inside combinations), get(shallowCopy, path) returns a reference to the original state object, so this mutates this.state.rules directly. Same issue exists in the new updateLicense cleanup path. Could cause missed re-renders.

updateLicense already uses lodash/set with toPath for the license value -- same pattern would work here.

Clearing a license doesn't clear the plus flag

The new code clears exception when the license is cleared, but leaves plus intact. If a user checks "Any later version", removes the license via the new root-level remove button, then picks a different license, the old + silently carries over (e.g., new license becomes MIT+ without the user re-enabling it).

Minor items:

  • spdxExceptions.sort() in the constructor mutates the imported module array in-place. Use [...spdxExceptions].sort() to sort a copy.
  • defaultInputValue in SpdxExceptionPicker is uncontrolled (initial-only). If the parent re-renders with a new value, the input won't update. Consider key={value} to force remount, or a controlled inputValue prop if the Autocomplete supports it.
  • index.css.map is a generated artifact -- should be in .gitignore, not committed.
  • The Netlify deploy preview is failing. Could be related to the index.css -> index.scss import change in src/index.js?
  • Worth confirming the FileList changes are intentional -- removing expandedRowKeys and setting childrenColumnName="_nochildren" disables tree expansion entirely, which means search results inside subdirectories won't render even though filterFiles() still returns nested children.

@capfei
Copy link
Copy Markdown
Member Author

capfei commented Mar 24, 2026

@ashleywolf Thank you for the feedback! ❤️ I'll start looking at each of the issues mentioned. I didn't even think to check the + checkbox.🤦‍♀️

…r fallback

- Replace space sentinel with 'pending' marker for exception picker open state
- Fix shallow copy mutations in updateException/updateLicense using lodash/set
- Clear both 'plus' and 'exception' flags when license is cleared
- Fix spdxExceptions.sort() mutating imported module array
- Add key prop to SpdxExceptionPicker for controlled remount
- Allow custom exception identifiers (ScanCode LicenseDB support)
- Handle parser returning noassertion for valid non-NOASSERTION expressions
- Exclude 'pending' sentinel from toString() serialization
- Add index.css.map to .gitignore and remove from tracking
- Restore FileList tree expansion (expandedRowKeys)
- Fix breadcrumb className formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants